//-------------------------------------------------------------------
//	Copyright (c) 2012-2014 Zhirnov Andrey
//	This file is part of the "UXGEN-ES" project.
//	See copyright notice in "Engine.h".
//-------------------------------------------------------------------

#pragma once

#include "UI/Widgets/Widget.h"

namespace Engine
{
namespace UI
{

	class ProgressBar;
	SHARED_POINTER( ProgressBar );



	//
	// Progress Bar
	//

	class ProgressBar : public Widget
	{
		friend struct ::MetaData::ProgressBarCfg;

	// variables
	protected:
		UIImage		_image;
		uvec2		_maxProgress;
		uint		_progress;


	// methods
	public:
		ProgressBar (EWidget::type wgtType, const EngineSubSystemsRef ess);
		~ProgressBar ();
		
		virtual bool ProcessMessage (const WidgetMsg &msg) override;

		
		static ProgressBarPtr	New (const EngineSubSystemsRef ess);


	protected:
		bool _Arrange (const WidgetMsg &msg);
		bool _Update (const WidgetMsg &msg);
		bool _Draw (const WidgetMsg &msg);
	};


	
/*
=================================================
	constructor
=================================================
*/
	ProgressBar::ProgressBar (EWidget::type wgtType, const EngineSubSystemsRef ess) :
		Widget( wgtType, ess ), _maxProgress(0,10), _progress(0)
	{
	}
	
/*
=================================================
	destructor
=================================================
*/
	ProgressBar::~ProgressBar ()
	{
	}
		
/*
=================================================
	ProcessMessage
=================================================
*/
	bool ProgressBar::ProcessMessage (const WidgetMsg &msg)
	{
		typedef WidgetMsg	WM;

		switch ( msg.GetType() )
		{
			case WM::UPDATE  :	return _Update( msg );
			case WM::DRAW :		return _Draw( msg );
			case WM::ARRANGE :	return _Arrange( msg );
		}

		return Widget::ProcessMessage( msg );
	}
		
/*
=================================================
	New
=================================================
*/
	ProgressBarPtr ProgressBar::New (const EngineSubSystemsRef ess)
	{
		return BaseObject::_New( new ProgressBar( EWidget::PROGRESS_BAR, ess ) );
	}
		
/*
=================================================
	_Arrange
=================================================
*/
	bool ProgressBar::_Arrange (const WidgetMsg &msg)
	{
	}
	
/*
=================================================
	_Update
=================================================
*/
	bool ProgressBar::_Update (const WidgetMsg &msg)
	{
	}
	
/*
=================================================
	_Draw
=================================================
*/
	bool ProgressBar::_Draw (const WidgetMsg &msg)
	{
	}


}	// UI
}	// Engine